package client.connect;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;

import javax.swing.JButton;
import javax.swing.JPanel;



public class PanelButton extends JPanel {
	
	private JButton buttonChat;
	public FrameConnect frame;
	
	public PanelButton(FrameConnect frame) {
		
		this.frame =  frame;
		setPreferredSize(new Dimension(400, 35));
		setLayout(new BorderLayout());

		buttonChat = new JButton("Chat");
		buttonChat.addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent e) {
				// TODO Auto-generated method stub
				ArrayList<String >lm= getFrame().getSelectedMember();
				
				String []tabS = new String [lm.size()];int i=0;
				
				for(String s : lm)
				{
					tabS[i]=s; i++;
				}
				
				getFrame().client.createGroup( tabS);
				//new client.chat.FrameChat(getFrame().client.getClientNom()+"::"+lm+"'s group", getFrame());
				
			}
		});
		
		add(buttonChat, BorderLayout.EAST);
		
		setVisible(true);
	}
	
	
	
	FrameConnect getFrame()
	{
		return this.frame;
	}
}
